<?php

namespace Admin\Controller;

class AdminController extends BaseController
{
  var $adminObj;

  public function __construct()
  {
    parent::__construct();
    $this->adminObj = D('Admin');
  }

  /**
   * 管理员列表显示
   */
  public function index()
  {

    $list = $this->adminObj->adminList();
    $num = count( $list['list']);
    $this->assign('num', $num);
    $this->assign('admin', $list['list']);
    $this->assign('page', $list['page']);
    $this->display();
  }

  /**
   * 删除管理员
   */
  public function delete()
  {
    $id = I("id");
    $admin = M("Admin");
    $res = $admin->where("id=$id")->delete();
    if ($res) {
      $this->success('删除成功', '');
    } else {
      $this->success('删除失败', '');
    }
  }




}


